<template>
  <el-dialog v-model="visible" modal-class="audit-dialog" width="500" align-center center :show-close="false">
    <div class="sure">
      <div>
        <el-icon>
          <Warning />
        </el-icon>
      </div>
      <span>{{ message }}</span>
    </div>
    <template #footer>
      <div class="dialog-footer mt50">
        <div>
          <el-button @click="visible = false" style="width: 120px">取消</el-button>
          <el-button type="primary" @click="submit" style="width: 120px">{{ btnText }}</el-button>
        </div>
      </div>
    </template>
  </el-dialog>
</template>

<script setup>
import { computed, ref } from "vue";

const props = defineProps({
  isOpen: {
    type: Boolean,
    default: false
  },
  message: {
    type: String,
    default: "---"
  },
  btnText: {
    type: String,
    default: "确认"
  }
});
const emit = defineEmits(["update:isOpen", "submit"]);
const visible = computed({
  get() {
    return props.isOpen;
  },
  set(value) {
    emit("update:isOpen", value);
  }
});

const submit = () => {
  emit("submit");
};
</script>

<style scoped lang="scss">
.sure {
  text-align: center;
  span {
    font-size: 14px;
    color: #3d3d3d;
    line-height: 20px;
  }

  ::v-deep(.el-icon) {
    font-size: 60px;
    margin-bottom: 20px;
    color: rgb(255, 51, 51);
  }
}
.audit-dialog {
  .goods-detail {
    margin-bottom: 20px;
  }
}

.alert {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 54px;
  margin: 0 0 10px;
  background: #ffd9c2;
  border-radius: 6px;

  .el-icon {
    color: #e37318;
    margin: 0 10px;
  }
}

.dialog-footer-flex {
  display: flex;
  justify-content: space-between;
}
</style>
